param(
	[String] $buildConfiguration = "Debug"
)

$executingScriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
. "$executingScriptDir\PsUtils.ps1"

$solutionsToBuild = @(
	"$pathSource\CommonLibraries\CommonLibraries.sln",
	"$pathSource\ParamGate\ParamGate.sln",
	"$pathSource\WcfEasyProxy\WcfEasyProxy.sln",
	"$pathSource\EncryptedConfigurationViewer\EncryptedConfigurationViewer.sln"
)

$pathSettings = "$pathRoot\Settings.txt"

if((Test-Path "$pathSettings") -eq $false){
	copy "$executingScriptDir\DefaultSettings.txt" $pathSettings
}

$config = Load-Settings($pathSettings)

function Get-FrameworkDirectory()
{
	$path=$null
	if (Test-Path $config.Netframework) {$path=$config.Netframework}
	if (Test-Path $config.Netframework64) {$path=$config.Netframework64}
	$path
}

$sharpDevelopDir=$config.SharpDevelopDir
$msbuild = Join-Path (Get-FrameworkDirectory) MSBuild.exe

$solutionsToBuild | ForEach-Object {Invoke-Expression "$msbuild /target:Rebuild /property:""Configuration=$buildConfiguration"" /property:""Platform=Any CPU"" /property:""SharpDevelopBinPath=$sharpDevelopDir"" $_"}